package com.cbhb.sys;

public class TruncateSentence {

    public static String truncateSentence(String s, int k) {
        String[] split = s.split(" ");
        StringBuilder sb = new StringBuilder();
        for(int i=0;i<k;i++) {
            sb.append(split[i]).append(" ");
        }
        return sb.toString().trim();
    }

    public static void main(String[] args) {
        System.out.println(truncateSentence("chopper is not a tanuki", 5));
    }
}
